/**
 * Created by Administrator on 2022/8/31.
 */
interface IFlying {
    void fly();
}
interface IRuning {
    void run();
}
interface ISwimming {
    void swim();
}
class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
class Dog extends Animal implements IRuning {
    public Dog(String name, int age) {
        super(name, age);
    }

    public void run() {
        System.out.println(name+age+"会跑");
    }
}

class Duck extends Animal implements IFlying,IRuning,ISwimming {
    public Duck(String name, int age) {
        super(name, age);
    }
    public void fly() {
        System.out.println(name+age+"会飞");
    }
    public void run() {
        System.out.println(name+age+"会跑");
    }
    public void swim() {
        System.out.println(name+age+"会游泳");
    }
}
public class Test3 {
    public static void main(String[] args) {
        Dog dog = new Dog("阿黄",1);
        dog.run();
        Duck duck = new Duck("小黄鸭",2);
        duck.run();
        duck.fly();
        duck.swim();
    }
}
